﻿@model EvincePayroll.Data.PageTemplateData
@{
    Layout = "~/Views/Shared/_Layout_Admin.cshtml";


 <link href="../../Content/Editer/jquery.wysiwyg.css" rel="stylesheet" type="text/css" />
    <script src="../../js/Editer/jquery.wysiwyg.js" type="text/javascript"></script>
    
    <script type="text/javascript" src="../../js/Editer/wysiwyg.image.js"></script>
<script type="text/javascript" src="../../js/Editer/wysiwyg.link.js"></script>
<script type="text/javascript" src="../../js/Editer/wysiwyg.table.js"></script>
<script type="text/javascript">
    (function ($) {
        $(document).ready(function () {
            $('#Editor1').wysiwyg({
                controls: {
                    bold: { visible: true },
                    italic: { visible: true },
                    underline: { visible: true },
                    strikeThrough: { visible: true },

                    justifyLeft: { visible: true },
                    justifyCenter: { visible: true },
                    justifyRight: { visible: true },
                    justifyFull: { visible: true },

                    indent: { visible: true },
                    outdent: { visible: true },

                    subscript: { visible: true },
                    superscript: { visible: true },

                    undo: { visible: true },
                    redo: { visible: true },

                    insertOrderedList: { visible: true },
                    insertUnorderedList: { visible: true },
                    insertHorizontalRule: { visible: true },

                    h4: {
                        visible: true,
                        className: 'h4',
                        command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
                        arguments: ($.browser.msie || $.browser.safari) ? '<h4>' : 'h4',
                        tags: ['h4'],
                        tooltip: 'Header 4'
                    },
                    h5: {
                        visible: true,
                        className: 'h5',
                        command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
                        arguments: ($.browser.msie || $.browser.safari) ? '<h5>' : 'h5',
                        tags: ['h5'],
                        tooltip: 'Header 5'
                    },
                    h6: {
                        visible: true,
                        className: 'h6',
                        command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
                        arguments: ($.browser.msie || $.browser.safari) ? '<h6>' : 'h6',
                        tags: ['h6'],
                        tooltip: 'Header 6'
                    },

                    cut: { visible: true },
                    copy: { visible: true },
                    paste: { visible: true },
                    html: { visible: true },
                    increaseFontSize: { visible: true },
                    decreaseFontSize: { visible: true },
                    exam_html: {
                        exec: function () {
                            this.insertHtml('<abbr title="exam">Jam</abbr>');
                            return true;
                        },
                        visible: true
                    }
                },
                events: {
                    click: function (event) {
                        if ($("#click-inform:checked").length > 0) {
                            event.preventDefault();
                            alert("You have clicked jWysiwyg content!");
                        }
                    }
                }
            });

            $('#Editor1').wysiwyg();
        });
    })(jQuery);
    $(document).ready(function () {
        $('.wysiwyg').css('width', '98%');
        $('.wysiwyg').find('iframe').css('width', '100%');
        $('#btnCancel').click(function () {
            $('#element_1_1').val('');
            $('#element_2').val('');
            $('#element_3').val('');
            $('#element_4').val('');
            $('#Editor1').val('');
            $('#chkstatus').val('');



            return false;
        });
        $('#PageCodeError').hide();
        $('#displayError').hide();
        $('#metakeyError').hide();
        $('#contentError').hide();
        $("#validate1").submit(function () {
            var flag = false;
            $('#PageCodeError').hide();
            $('#displayError').hide();
            $('#metakeyError').hide();
            $('#contentError').hide();

            var pageCode = $('#element_1_1').val();
            var dispaly = $('#element_2').val();
            var metakey = $('#element_3').val();
            var content = $('#Editor1').val();
            if (pageCode == "") {
                $('#PageCodeError').show();

                flag = true;
            }
            if (dispaly == "") {
                $('#displayError').show();

                flag = true;
            }
            if (metakey == "") {
                $('#metakeyError').show();

                flag = true;
            }
            if (content == "") {
                $('#contentError').show();

                flag = true;
            }
            if (flag == true) {
                return false;
            }
        });


    });


   
                              

</script>

    using (@Html.BeginForm("AddPage", "PageTemplate", FormMethod.Post, new { id = "validate1" }))
    { 
    <div class="grid_10">
        <div class="box round first" style="height: auto; margin-left: 90px; width: 73%; " >
            <h2>
                Add CMS</h2>
            <div class="block">
                <div id="chart1">
                    <div class="block">
                      <ul style="width: 95%; border: 1px solid gray;">
                                         <li>
                                        @Html.HiddenFor(m => m.PageId, new { id = "PageID", name = "PageID" ,@class="pageId" })
                                        <script type="text/javascript">
                                            $(document).ready(function () {
                                               
                                                var x = $('#PageID').val();
                                                
                                                if (x != '') {
                                                    $('#add').hide();

                                                }

                                                if (x == '') {
                                                    $('#update').hide();

                                                }
                                            });
                                        </script>
                                         </li>   
                                         
                                        <li id="li_1">
                                            <label class="description" for="element_1">
                                                Page Code
                                            </label>
                                            <br />
                                            <span>
                                                @Html.TextBoxFor(m => m.PageCode, new { id = "element_1_1", @class = "element text", maxlength = "255", size = "8", value = "" })
                                                <span class="error" id="PageCodeError">*</span>
                                               
                                                     </span></li>
                                        <li id="li_2">
                                            <label class="description" for="element_2">
                                                Display Title
                                            </label>
                                            <br />
                                            <div>
                                                @Html.TextBoxFor(m => m.DisplayTitle, new { id = "element_2", name = "element_2", @class = "element text medium", type = "text", maxlength = "255", value = "" })
                                                <span class="error" id="displayError">*</span>
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                      @*  <li id="li_8">
                                            <label class="description" for="element_3">
                                                Parent Pages
                                            </label>
                                            <br />
                                            <div>
                                                @Html.DropDownListFor(m => m.ParentId, new { id = "element_3", name = "parentPageId", @class = "element text medium", type = "text", maxlength = "255", value = "" })
                                                @Html.DropDownListFor(m => m.ParentId, new SelectList(ViewBag.ParentChild as System.Collections.IEnumerable), new { id = "parentChild", @class = "element text medium", @style = "float:left;" })
                                            </div>
                                            <br />
                                            <br />
                                        </li>*@
                                        <li id="li_3">
                                            <label class="description" for="element_3">
                                                Meta Keywords
                                            </label>
                                            <br />
                                            <div>
                                                @Html.TextBoxFor(m => m.MetaKeywords, new { id = "element_3", name = "element_3", @class = "element text medium", type = "text", maxlength = "255", value = "" })
                                                <span class="error" id="metakeyError">*</span>
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                        <li id="li_5">
                                            <label class="description" for="element_5">
                                                Meta Description
                                            </label>
                                            <br />
                                            <div>
                                                @Html.TextBoxFor(m => m.MetaDescription, new { id = "element_4", name = "element_3", @class = "element text medium", type = "text", maxlength = "255", value = "" })
                                                
                                            </div>
                                            </li>
                                            <li id="li_6">
                                            <label class="description" for="element_6">
                                                Contents
                                            </label>
                                            <br />
                                            <div style="float:left; width:98%;">
                                            @Html.TextAreaFor(m => m.Contents, new { id = "Editor1",type = "text",width="98%", cols="30", rows="10"})
                                           @*<textarea name="txtDescription" cols="30" rows="10" id="Editor1" style="width:100%;"></textarea>*@
                                            <span class="error" id="contentError">*</span>
                                            </div>
                                            <br />
                                            <br />
                                            <br />
                                        </li>
                                        <li id="li_7">
                                            <label class="description" for="element_6">
                                               Status
                                            </label>
                                            <br />
                                            <div style="float:left">
                                               <input type="checkbox" id="chkstatus" name="chksatatus" />
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                   
                                        <li id="li_13">
                                        
                                            
                                            <button class="btn btn-orange" id="add" runat="server">
                                    Add</button>
                                    <button class="btn btn-orange" id="update" runat="server">
                                    Update</button>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <button class="btn btn-orange" id="btnCancel">
                                    Cancel</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                                        <br />
                                        </li>
                                       <br />
                                    </ul>
                                  
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
}
    }